<?php
namespace app\admin\controller;

use think\App;
use hg\apidoc\annotation as Apidoc;
use app\common\lib\Show;
use app\common\model\JfUser as JfUserModel;
use think\Exception;

/**
 * @Apidoc\Title("掘粪用户管理")
 * @Apidoc\Group("JfUser")
 * @Apidoc\Sort("8")
 */

class JfUser extends AdminBaseController
{
  protected $jf_user_model;
  public function __construct(App $app)
  {
      parent::__construct($app);
      $this->jf_user_model = new JfUserModel();
  }
  /**
   * @Apidoc\Title("掘粪用户列表")
   * @Apidoc\Desc("获取掘粪用户列表接口")
   * @Apidoc\Author("ckmmd")
   * @Apidoc\Url("/admin/jf/user/get_jf_users")
   * @Apidoc\Method("POST")
   * @Apidoc\Tag("列表")
   * @Apidoc\Header( ref="auth")
   * @Apidoc\Header("auth", type="String",require=true, default="JfUser", desc="权限验证" )
   * @Apidoc\Param( ref="pagingParam")
   * @Apidoc\Param("nickname", type="string",require=false, desc="用户昵称查询" )
   * @Apidoc\Returned("data", type="object", desc="业务数据",
   *    @Apidoc\Returned( ref="pagingParam"),
   *    @Apidoc\Returned("list", type="array",ref="app\common\model\JfUser\getJfUserList", desc="数据列表")
   * )
   */
  public function getJfUsers(){
    if (!$this->request->isPost()) {
      return Show::error('错误的请求');
    }
    try {
      $qurey_info = $this->request->param();
      $result = $this->jf_user_model->getJfUserList($qurey_info, $this->super_user_auth);
      return Show::success($result);
    } catch (Exception $e) {
      return Show::error($e->getMessage());
    }
  }
  /**
   * @Apidoc\Title("修改绝粪用户状态")
   * @Apidoc\Desc("修改绝粪用户状态接口")
   * @Apidoc\Author("ckmmd")
   * @Apidoc\Url("/admin/jf/user/status_jf_user")
   * @Apidoc\Method("POST")
   * @Apidoc\Tag("修改数据状态")
   * @Apidoc\Header( ref="auth")
   * @Apidoc\Header("auth", type="String",require=true, default="DelJfUser", desc="权限验证" )
   * @Apidoc\Param("id", type="int",require=true, desc="用户ID" )
   * @Apidoc\Param("status", type="int",require=true, desc="状态：1（正常），0（禁用），-1（删除）" )
   * @Apidoc\Returned("data", type="int", desc="业务数据")
   */
  public function statusJfUser()
  {
    if (!$this->request->isPost()) {
      return Show::error('错误的请求');
    }
    $qurey_info = $this->request->param();
    try {
      $result = $this->jf_user_model->statusJfUser($qurey_info);
      return Show::success($result);
    } catch (Exception $e) {
      return Show::error($e->getMessage());
    }
  }
}